package com.ruibang.glass.quality.controller.manage;

import com.ruibang.glass.quality.domain.req.SL01QualityMonitorReq;
import com.ruibang.glass.quality.domain.resp.FreDefectConfig;
import com.ruibang.glass.quality.domain.resp.SL01QualityMonitorResp;
import com.ruibang.glass.quality.service.SL01QualityMonitorService;
import com.teaming.cloud.framework2.common.model.ResultBody;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;
import java.util.List;

/**
 * @Author: songJinKang
 * @CreateTime: 2024-05-24  10:46
 * @Description: TODO
 * @Version: 1.0
 */

@RestController
@RequestMapping("/api/quality/manage/sl01QualityMonitor")
@Api(value = "SL01检查品质监控", tags = {"SL01检查品质监控API"})
@Validated
public class SL01QualityMonitorController {

    @Autowired
    private SL01QualityMonitorService sl01QualityMonitorService;

    @PostMapping("/queryParticleDefect")
    @ApiOperation(value = "查询颗粒检-品质监控数据", notes = "查询颗粒检-品质监控数据")
    public ResultBody<SL01QualityMonitorResp> queryParticleDefect(@RequestBody @Valid SL01QualityMonitorReq sl01QualityMonitorReq) {
        return ResultBody.success(sl01QualityMonitorService.queryParticleDefect(sl01QualityMonitorReq));
    }

    @PostMapping("/queryFreDefect")
    @ApiOperation(value = "查询面复检缺-品质监控数据", notes = "查询面复检缺-品质监控数据")
    public ResultBody<SL01QualityMonitorResp> queryFreDefect(@RequestBody @Valid SL01QualityMonitorReq sl01QualityMonitorReq) {
        return ResultBody.success(sl01QualityMonitorService.queryFreDefect(sl01QualityMonitorReq));
    }

    @PostMapping("/freDefectConfig")
    @ApiOperation(value = "配置面复检缺陷配置", notes = "配置面复检缺陷配置")
    public ResultBody freDefectConfig(@RequestBody @Valid List<FreDefectConfig> freDefectConfig) {
        sl01QualityMonitorService.freDefectConfig(freDefectConfig);
        return ResultBody.success();
    }

    @GetMapping("/getFreDefectConfig")
    @ApiOperation(value = "获取面复检缺陷配置", notes = "获取面复检缺陷配置")
    public ResultBody<List<FreDefectConfig>> getFreDefectConfig() {
        return ResultBody.success(sl01QualityMonitorService.getFreDefectConfig());
    }
}
